##brep作为occ原生的格式，加载速度快，需要特别注意。
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCC.Display.SimpleGui import init_display
from OCC.Core.BRepTools import breptools_Read,breptools_Write
from OCC.Core.TopoDS import TopoDS_Shape
from OCC.Core.BRep import BRep_Builder


# 建造一个正方体，并写入brep
box_shp = BRepPrimAPI_MakeBox(10, 20, 20).Shape()

breptools_Write(box_shp,'box.brep')
print("已经成功写入brep")

#读入一个brep
read_box = TopoDS_Shape()
builder = BRep_Builder()
breptools_Read(read_box, 'box.brep', builder)



display, start_display, add_menu, add_function_to_menu = init_display()
display.DisplayShape(read_box, update=True)
start_display()

